package com.qf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.qf
 * @Description:
 * @Date 2022/7/6 11:26
 */
@SpringBootApplication
//将启动类交给
@EnableEurekaClient
//开启feign远程调用并扫描feign接口  name的值是被调用的服务名
@EnableFeignClients(basePackages = {"com.qf.searchFeign"})
public class CustomerApplication {
    public static void main(String[] args) {
        SpringApplication.run(CustomerApplication.class,args);
    }
    /**
     * 将resttemplate对象 初始化
     * @return
     */
    @Bean
    //给远程调用对象
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
